package Exception.a;

import javax.management.RuntimeErrorException;

public class Person {

	/**
	 * Throw异常情况1：不符合业务逻辑
	 */
	private int age;
		
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		if(age>100||age<0){
			throw new RuntimeException("不是人类的年龄");
		}
		this.age = age;
	}
	public static void main(String[] args) {
		Person p= new Person();
		p.setAge(120);
		System.out.println("我的年龄是："+p.getAge());
	}
}
